//
//  QuestionView.m
//  BMW
//
//  Created by up72-2 on 15/10/26.
//  Copyright © 2015年 up72-2. All rights reserved.
//

#import "QuestionView.h"
#import "SignatureView.h"
#import "AppDelegate.h"
#import "BMWQusetionModel.h"
@interface QuestionView()
@property (strong,nonatomic) SignatureView *signatureView;
@property (strong,nonatomic) BMWQusetionModel *questionModel;
@end

@implementation QuestionView
NSArray *tempArray;

- (void)awakeFromNib {
    self.mainView.layer.borderWidth = 1;
    self.mainView.layer.borderColor = [UIColor blackColor].CGColor;
}

#pragma 网络请求
- (void)requestStart:(NetManager *)request
{
}

- (void)requestError:(NetManager *)request error:(NSError *)error
{
    
}

- (void)requestDidFinished:(NetManager *)request result:(NSMutableDictionary *)result
{
    NSInteger status = [[NSString stringWithFormat:@"%@",[result objectForKey:@"state"]] integerValue];
    
    if (status == 0) {
        [MTool showMessage:[NSString stringWithFormat:@"%@",[result objectForKey:@"errorMsg"]] inView:self];
        return;
    }
    
    NSURLRequest *temp = [NSURLRequest requestWithURL:[NSURL URLWithString:[[result objectForKey:@"data"] objectForKey:@"url"]]];
    [self.mainWebView loadRequest:temp];
}

- (IBAction)checkBtn:(UIButton *)sender {
    [self endEditing:YES];
    NSString *phoneNum = self.teleTF.text;
    
    if (![IdentifierValidator isValid:IdentifierTypePhone value:phoneNum]) {
        [MTool showMessage:@"请输入正确的手机号" inView:self];
        return;
    }
    
    if (!netManager) {
        netManager = [[NetManager alloc] init];
        [netManager setDelegate:self];
    }
    
    [netManager setLoadingText:@"正在检索"];
    [netManager getInfoUrl:self.teleTF.text];
    
    
    
}
@end
